<%@ page contentType="text/html;charset=UTF-8" %>
<!DOCTYPE html>
<html lang="zh-CN">
 <head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <%@ include file="/common/${sysEname}/include/common-base.jsp"%>
  <title>我的收藏-${r'${titleName}'}</title>
</head>
<body class="hold-transition ${r'${sysUserColor}'} sidebar-mini">
<div class="wrapper">

  <!-- top start -->
  <%@include file="/common/${sysEname}/top-user.jsp" %>
  <!-- top end -->

  <!-- left start -->
  <%@include file="/common/${sysEname}/left-user.jsp" %>
  <!-- left end-->

<!-- main start -->
<div class="content-wrapper">
<div class="content">
 <div class="panel">
  	<div class="panel-heading">
  		<h4 class="fx2"><i class="fa fa-envelope"></i> 我的收藏</h4>
  		 	<form class="form-horizontal" role="form" id="myForm" action="javascript:void(0)" method="post">
         	<!--<input type="hidden" name="doCode" value="Fpages"/>-->
	         	<input type="hidden" name="pageName" value="nyt-myCollection.jsp"/>
	         	<input type="hidden" name="formName" value="searchForm"/>
	         	<input type="hidden" name="pubKeepInfo.w_userEname" value="${r'${loginUser.userEname }'}"/>
	         	<input type="hidden" name="orderBy" value="pubKeepInfo.create_time desc"/>
	     </form>
  	</div>
  	<div class="panel-body">
  			<table id="dataList" class="table table-bordered table-hover">
            <thead>
              <tr>
                <th>收藏项目名称</th>
                <th>收藏时间</th>
                <th>操作</th>
              </tr>
            </thead>
            <tbody id="dataList-body">
            </tbody>
          </table>
          <center>
            <ul id="dataList-page">
            </ul>
          </center>
      </div>
    </div>
  </div>

<script type="text/template" id="dataList-template">
<? for ( var i = 0; i < rows.length; i++) {?>
	<tr>
		<td><a href="<?=rows[i].keepUrl?>" target="balnk"><?=rows[i].keepTitle?></a></td>
		<td><?=rows[i].createTime?></td>
		<td>
			<a href="#" onclick="toDele('<?=rows[i].keepId?>')" >删除</a>
		</td>
	</tr>
<?}?>
</script>
<script>
	var clickMenu = 'my-collection';
	$(function(){
		getList();
	});
	function getList(){
		var index_load = layer.load(1, {shade: false});
		$.ajax({
			type:'get',
			url: common_list_url,
			//async: false,
			data: $('#myForm').serialize()+getCurrentPage(common_list_url+"?"+$('#myForm').serialize(),8),
			dataType:'json',
			success:function(myData){
				layer.close(index_load);
				console.log(myData);
				var data = baidu.template('dataList-template',eval(myData));
				$("#dataList-body").html(data);
				  var option= {
						   ele:$("#dataList-page")[0],
						   total:myData.total,
						   fn:getList,
						   url:common_list_url+"?"+$('#myForm').serialize()
					   }
				generatePages(option);
			}
		});
	}

	//删除信息（逻辑删除）
	function toDele(id){
		var index_submit = layer.confirm('您确定要删除信息吗？', {btn: ['Yes','No'],closeBtn: 0,offset: '220px'}
		, function(){
			layer.close(index_submit);
			var paramData = {"pageName":"nyt-myCollection.jsp","formName":"delForm","pubKeepInfo.w_keepId":id};
			$.ajax({
			    type:"post",
			    url:common_submit_url,
			    data: paramData,
			    dataType:"json",
			    success: function(myData){
			    	var result = myData.flag;
			    	if(result=="T"){
			    		layer.alert("删除操作成功");
			    		getList();
			    	}
			  	}
			});
		});
	}


</script>

</div>



</div>
  <!-- foot start -->
  <%@include file="/common/${sysEname}/foot-user.jsp" %>
  <!-- foot start -->
</body>

</html>


